var arr =  [
    {num1:0},
    {num2:2},
    {num3:0},
    {num4:0}
]
console.log(arr[0].num1)

const sum = (arr) => {
    let he = 0;
    for(let i =0;i<arr.length;i++) {
        he+=arr[i][`num${i+1}`]
    }
    // console.log(he)
    return he
}
console.log(sum(arr))
